package com.sbx.entity.dto;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.sbx.validations.RequiredField;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotEmpty;
import java.util.Date;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@TableName("user")
public class User {


    @TableId(type = IdType.ASSIGN_UUID)
    @ApiModelProperty("用户id")
    private String id;

    @TableField("nickName")
    @ApiModelProperty("昵称")
    @NotEmpty(message = "昵称不能为空", groups = RequiredField.class)
    private String nickName;

    @TableField("userName")
    @ApiModelProperty("用户名")
    @NotEmpty(message = "用户名不能为空", groups = RequiredField.class)
    private String userName;

    @ApiModelProperty("密码")
    @NotEmpty(message = "密码不能为空", groups = RequiredField.class)
    private String password;

    @ApiModelProperty("用户头像")
//    @NotEmpty(message = "头像不能为空",groups = UserSave.class)
    private String head;

    @ApiModelProperty("手机号")
    @NotEmpty(message = "手机号不能为空", groups = RequiredField.class)
    private String phone;

    @ApiModelProperty("用户邮箱")
    @NotEmpty(message = "邮箱不能为空", groups = RequiredField.class)
    private String email;

    @ApiModelProperty(value = "用户状态 0-正常, 1-禁用 ,2-注册待确认")
//    @NotNull(message = "",groups = UserSave.class)

    private Integer state;

    @ApiModelProperty(value = "角色id  0-超级管理员 , 1-普通用户")
//    @NotEmpty(message = "角色id不能为空",groups = UserSave.class)
    private String roleId;

    @ApiModelProperty(value = "创建时间", example = "2023-02-08 21:44:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date created;

    @ApiModelProperty(value = "更新时间", example = "2023-02-08 21:44:00")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updated;

    @ApiModelProperty("创建人")
    private String creator;

    @ApiModelProperty("在线状态")
    private Boolean online;

    @ApiModelProperty("路由信息")
    @TableField(exist = false)
    private List<Route> routes;

    @ApiModelProperty("app商城信息")
    @TableField(exist = false)
    private List<AppStore> appStores;
}
